package com.learning.railwayreservation.biz;

import java.util.List;

import com.learning.railwayreservation.dao.TicketDao;
import com.learning.railwayreservation.dao.TrainDao;
import com.learning.railwayreservation.dao.PassengerDao;
import com.learning.railwayreservation.vo.PassengerVO;
import com.learning.railwayreservation.vo.TicketVO;
import com.learning.railwayreservation.vo.TrainVO;

public class Enquiry {
    public static void main(String args[])
	{
    	System.out.println("\nhere is the result\n");
    	System.out.println("\nList of Passengers\n");
        doPassengerEnquiry("a"); 
        System.out.println("\nList of Tickets\n");
        doTicketEnquiry(1);
        System.out.println("\nList of Trains\n");
		doTrainEnquiry();
     	
	}

     public static void doPassengerEnquiry(String pasengerName){
    
    	 PassengerDao myEnquiry = new PassengerDao();
 		List<PassengerVO> passengerList = myEnquiry.getPassengersFromPassengerName(pasengerName);
 		for(PassengerVO passengerVO: passengerList){
 			System.out.print("\nNAME: "+passengerVO.getFirstName());
 			System.out.print(", AGE: "+passengerVO.getAge());
 			System.out.print(", SEX: "+passengerVO.getSex());
 		    System.out.print(", BERTH PREFERENCE: "+passengerVO.getBerthPreference());
 		    System.out.print(", SENIOR CITIZEN: "+passengerVO.getSeniorCitizen());
 			
 		}
	 
	 
 }	
     public static void doTicketEnquiry(int pnrNumber){	
    	 TicketDao tdao = new TicketDao();
    		List<TicketVO> ticketList = tdao.getTicket(pnrNumber);
//    		for (TicketVO ticketVO : ticketList) {
//    			System.out.print("\nTicket number: "
//    					+ ticketVO.getTicketNumber());
//    			System.out.print(", pnr: " + ticketVO.getPnrNumber());
//    			System.out.print(", id: " + ticketVO.getId());
//    			System.out.print(", departure info: " + ticketVO.getDepartureTime());
//    			System.out.print(", arrival info: " + ticketVO.getArrivalTime());
//    			System.out.print(", departure from: " + ticketVO.getDepartureFrom());
//    			System.out.print(", arrival to: " + ticketVO.getArrivalTo());
//    			System.out.print(", berth: " + ticketVO.getBerth());
//    			System.out.print(", coach: " + ticketVO.getCoach());		
//    			
//    			
//    		}
     }
     public static void doTrainEnquiry(){
    	 TrainDao tdao = new TrainDao();
 		List<TrainVO> trainList = tdao.getTrainsFromTrainType("express");
 		for (TrainVO trainVO : trainList) {
 			System.out.print("\nMASTER TRAIN ID " + trainVO.getMasterTrainId());
 			System.out.print("  ,ROUTE ID   " + trainVO.getRouteId());
 		    System.out.print("  ,Train Name:  " + trainVO.getTrainName());
 			System.out.print("  ,Train Type:  " + trainVO.getTrainType());
 				} 
     }

}